package com.moleq.models;

import com.moleq.db.DatabaseSchema;

import android.R.integer;

public class InventorySetting {
//	CREATE TABLE t_inventory_setting
//	(is_id INTEGER NOT NULL,
//	is_onoff varchar(1) DEFAULT '0' NOT NULL,
//	is_server_ip varchar(15) NULL,
//	PRIMARY KEY (is_id));
	public InventorySetting(){}
	public InventorySetting(int is_id,String is_onoff,String is_server_ip){
		this.is_id = is_id;
		this.is_onoff = is_onoff;
		this.is_server_ip = is_server_ip;
	}
	private int is_id;
	private String is_onoff;
	private String is_server_ip;
	public int getIs_id() {
		return is_id;
	}
	public void setIs_id(int is_id) {
		this.is_id = is_id;
	}
	public String getIs_onoff() {
		if(is_onoff == null){
			return "0";
		}else{
			return is_onoff;
		}
	}
	public void setIs_onoff(String is_onoff) {
		this.is_onoff = is_onoff;
	}
	public String getIs_server_ip() {
		if(is_server_ip == null){
			return "";
		}else{
			return is_server_ip;
		}
	}
	public void setIs_server_ip(String is_server_ip) {
		this.is_server_ip = is_server_ip;
	}
	public String toMGData(String Action) {
		String Result = Action + "|" + DatabaseSchema.InventorySetting.SCHEMA_NAME
				+ "|(" + "1" + "," + CheckNull(is_onoff) + "," + CheckNull(is_server_ip) + ")";
		return Result;
	}
	
	public String CheckNull(String value) {
		if (value == null) {
			return null;
		} else {
			return "'" + value + "'";
		}
	}
}
